<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>在线支付</title>
    <script src="./js/flexible.js"></script>
    <link rel="stylesheet" href="./css/reset.css">
    <link rel="stylesheet" href="./css/recharge.css">
</head>

<body>
    <div class="rechage">
        <header class="r-head">
            <a href="javascript:;"></a>
            <h2>在线支付</h2>
        </header>
        <div class="prompt">
            <p class="num">
                <span>购买数量</span>
                <span id="redu">-</span>
                <input id="add" type="text" value="1" style="width:50px; text-align:center;" />
                <span id="add1">+</span>
            </p>
        </div>
        <form action="">
            <div class="reg">
                <span>充值金额</span>
                <input type="" class="coin" placeholder="￥">
            </div>
            <div class="reg tac">
                <span>合计：</span>
                <span style="margin-right:.66rem">￥666</span>
            </div>
            <div class="payment">
                <p class="pay-method">
                    <i class="alipay"></i>
                    <span>支付宝支付</span>
                </p>
                <a href="javascript:;" class="dui"><i class="duihao"></i></a>
            </div>
            <button class="r-btn">确认支付</button>
        </form>
    </div>
</body>
<script src="./js/zepto.js"></script>
<script src="./js/index.js"></script>
<script type="text/javascript">
    $(".num").ready(function () {
        $("#add1").click(function () {
            var oldValue = parseInt($("#add").val()); //取出现在的值，并使用parseInt转为int类型数据  
            oldValue++ //自加1  
            $("#add").val(oldValue) //将增加后的值付给控件  
        });
        $("#redu").click(function () {
            var oldValue = parseInt($("#add").val()); //取出现在的值，并使用parseInt转为int类型数据  
            if (oldValue <= 1) {
                oldValue = 1
            } else {
                oldValue-- //自减1  
                $("#add").val(oldValue) //将增加后的值付给控件  
            }
        });

    });
</script>

</html>